package com.xgsm.springsecurityauthdemo.Controllers;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("demo")
public class DemoController {
    @RequestMapping("hello")
    //只有'hello'权限才能访问
//    @PreAuthorize("hasAnyAuthority('dev:code:pull')")
//    使用自己自定义权限校验
    @PreAuthorize("@ex.hasAuthority('dev:code:pull')")
    public String AuthDemo(){
        return "这是一个Auth认证项目";
    }
}
